package com.example.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.entity.Goods;
import com.example.entity.Price;
import com.example.mapper.PriceMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.management.Query;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 价格 前端控制器
 * </p>
 *
 * @author fanbinbing
 * @since 2021-11-30
 */
@RestController
@RequestMapping("/price")
public class PriceController {
    @Autowired
    private PriceMapper PriceMapper;
    @GetMapping("/selectByPrice")
    public Map<String,Object> selectByPrice(){
        QueryWrapper<Price> wrapper = new QueryWrapper<>();
        wrapper.lambda().eq(Price::getPrices,25.6);
        IPage<Price> priceIPage = PriceMapper.selectByPrice(new Page<>(1, 1),null);
        List<Price> list = priceIPage.getRecords();
        Map<String, Object> map = new HashMap<>();
        map.put("code",200);
        map.put("msg","查询成功");
        map.put("data",list);
        return map;//未完待续
    }

}

